home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2842 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.5 KB  |  57 lines

  1. Path: news.ios.com!usenet
  2. From: vlad@gramercy.ios.com (vlad)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: prob. exporting functions in Borland C++ into DLL
  5. Date: Sat, 20 Jan 1996 00:48:00 GMT
  6. Organization: Internet Online Services
  7. Message-ID: <4dpdtb$1rs@news.ios.com>
  8. References: <4dl117$ace@news.danadata.dk>
  9. NNTP-Posting-Host: ppp-41.ts-7.hck.idt.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. televis@aix1.danadata.dk (Thomas Zaschke) wrote:
  13.  
  14. >My problem:
  15.  
  16. >I am writing a Windows-DLL (16-bit), to be used by a non-C application.
  17. >All my sources are compiled with Borlands C++ compiler from within
  18. >Borland C++ 4.53. All extensions are *.cpp.
  19.  
  20. >I want to export a function "MyFunc".
  21.  
  22. >1) When using "_export" before the function-name, the resulting DLL does 
  23. >not
  24. >content the name "MyFunc" as i would expect, but something like 
  25. >"MyFunc$QV".
  26.  
  27. >2) When using a .def file and exporting "MyFunc" explicitly, i get this 
  28. >error
  29. >message "Attempt to export non-public symbol <myfunction-name>".
  30.  
  31. >I do not experience these problems when compiling and linking pure 
  32. >C-source.
  33.  
  34. >My question is:
  35.  
  36. >How can I export "MyFunc" in a DLL and be sure that other applications
  37. >actually can see the correct name: "MyFunc" ?
  38.  
  39. >If I am forced to use a .def file (to export by ordinal), how do I get 
  40. >this
  41. >to work without the before mentioned error ?
  42.  
  43.  
  44. try this:
  45. ~~~~~
  46.  
  47. extern "C" MyFunc()
  48.   {
  49.     ...your code;   
  50.   }
  51.  
  52. *******************************************
  53. *    Vlastimil Adamovsky                  *
  54. *  Smalltalk and C++ development          *
  55. *******************************************
  56.  
  57.